<template>
  <Card title="志愿者用户 - 列表">
    <Card :bordered="false">
      <Input v-model="bo.cuVolunteersName" placeholder="请输入姓名标题关键字查询" style="width: 15vw"></Input>
      <Button type="primary" @click="query" style="margin-left: 15px">查询</Button>
    </Card>
    <Table border stripe ref="selection" size="small" :columns="columns" :data="nowData">

    </Table>
    <Page :total="dataCount" :page-size="bo.size" @on-change="changepage" @on-page-size-change="_nowPageSize"
          show-total show-sizer show-elevator/>
  </Card>
</template>

<script>
export default {
  name: "volunteers_user",
  data() {
    return {
      dataCount:0,
      nowData: [],
      columns: [{
        title: '序号',
        key: 'cuVolunteersUserId'
      },
        {
          title: '注册人姓名',
          key: 'cuVolunteersName'
        },
        {
          title: '注册人身份证',
          key: 'cuVolunteersNum'
        }, {
          title: '性别',
          key: 'cuVolunteersSex',
          render:(h,params)=>{

            let gender = params.row.cuVolunteersSex
            if(gender == 0){
              gender = '女'
            }else if(gender == 1){
              gender = '男'
            }
            return h('span',gender)
          },
        }, {
          title: '职业',
          key: 'cuVolunteersOccupation'
        }, {
          title: '住址',
          key: 'cuVolunteersAddress'
        }, {
          title: '手机号',
          key: 'cuVolunteersPhone'
        }, {
          title: '注册时间',
          key: 'cuVolunteersCreateDate'
        }, {
          title: '个人说明',
          key: 'cuVolunteersMessage'
        }],
      bo:{
        size:10,
        current:1,
        cuVolunteersName:"",
      },
    }
  }, methods: {
    query() {
      this.$axios_supermall.post("/cu-volunteers-user/selectPage",this.bo).then(resp =>{
        if (resp.data.code == 0){
          let data = resp.data.data
          this.nowData = data.records
          this.bo.current = data.current
          this.bo.size = data.size
          this.dataCount = data.total
        }
      });
    },
    changepage(index){
      this.bo.current = index;
      this.query()
    },
    _nowPageSize(index){
      // 实时获取当前需要显示的条数
      this.bo.size = index
    },
  }, mounted() {
    this.query();
  }
}
</script>

<style scoped>

</style>
